#include <iostream>
#include <fstream>
#include <ctime>
#include <vector>
using namespace std;
vector <int> gg;
vector <int> bubblesort(vector <int> gg){
  for(int i = 0; i < gg.size() ; i++){
    int k = 0;
    for(int j = 0;j < gg.size() - 1 - i; j++){
      if(gg[j] > gg[j + 1]){
        int b = gg[j];
        gg[j] = gg [j + 1];
        gg[j + 1] = b;
        k++;
      }
      }
    if (k == 0)
    {
      break;
    }
    }
  return gg;
  }
int main(){
  ifstream f1;
  f1.open("m1_sorted.txt");
  int x;
  while(f1>>x){
    gg.push_back(x);
  }
  double start_time = clock();
  gg = bubblesort(gg);
  double finish_time = clock();
  cout << "m1_sorted " << (finish_time - start_time) / 1000
  <<" milliseconds"<< endl;
  ifstream f2;
  f2.open("m2_reverse.txt");
  int q;
  while(f2>>x){
    gg.push_back(x);
  }
  double start_time2 = clock();
  gg = bubblesort(gg);
  double finish_time2 = clock();
  cout << "m2_reverse " << (finish_time - start_time) / 1000
  <<" milliseconds"<< endl;
  ifstream f3;
  f3.open("m3_shuffle.txt");
  int w;
  while(f2>>x){
    gg.push_back(x);
  }
  double start_time3 = clock();
  gg = bubblesort(gg);
  double finish_time3 = clock();
  cout << "m3_shuffle " << (finish_time - start_time) / 1000
  <<" milliseconds"<< endl;
}